package org.wisdom.ab.domain.department.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Lob;

import org.springframework.core.annotation.Order;
import org.wisdom.data.jpa.annotation.SerialNumber;
import org.wisdom.data.jpa.entity.BaseEntity;

import lombok.*;

/**
 * 部门
 *
 * @author 张智研
 * @date 2022/05/16 08:16
 **/
@EqualsAndHashCode(callSuper = true)
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString(callSuper = true)
public class AbDepartment extends BaseEntity {
    /** 部门编码 */
    @Column(nullable = false, updatable = false)
    @SerialNumber(key = "{companyId}", value = "{m}")
    @Order(1)
    private String deptCode;
    /** 部门名称 */
    @Order(2)
    @Column(nullable = false)
    private String deptName;
    /** 部门名称(英文) */
    @Order(3)
    private String deptNameEn;

    /** 状态 */
    @Order(4)
    private Integer status;
    /** 上级部门id */
    @Column(nullable = false)
    @Order(5)
    private String parentId;
    /** 顺序 */
    @Column(nullable = false)
    @Order(6)
    private Integer order = 0;
    /** 部门id路径 从根部门id开始，一直到上级部门id，使用"/"拼接 */
    @Lob
    @Column(nullable = false)
    @Order(7)
    private String deptIdPath;
    /** 公司id */
    @Column(nullable = false, updatable = false)
    @Order(8)
    private String companyId;
}
